home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 July / Ahoy_Magazine_87-07_1987_Double_L_Side_A.d64 / Binary Power 1 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  333b  |  9 lines

  1. 0 rem << cd43-4 >>
  2. 1 rem ==================================
  3. 2 rem    commodares problem #39-3 :
  4. 3 print"[147]   [194]inary [208]ower 1"
  5. 4 rem    solution by
  6. 5 rem    david alan wright
  7. 6 rem ==================================
  8. 10 input"number to convert";n:fori=7to0step-1:j=2^i:k=int(n/j):a$=right$(str$(k),1):b$=b$+a$:c$=a$+c$:x=x+k*2^abs(7-i):n=n-j*k:next:printb$,c$,x
  9.